
'use strict'

const Router = require('koa-router')
const controllers = require('../controllers')
const jwt = require('../middlewares/jwt')
// -------------公共路由(无需token校验)-----------------------
const publicRouter = new Router()
publicRouter.prefix('/api')
publicRouter.post('/user/login', controllers.userController.login)


// --------------私有路由(需token校验)----------------------
const privateRouter = new Router()
privateRouter.prefix('/api')
privateRouter.use(jwt.verifyToken) // 校验token
privateRouter.get('/userlist', controllers.userController.getUserList)
privateRouter.get('/user/:id', controllers.userController.getUserInfo)
module.exports = {
  publicRouter, privateRouter
}
